<?
	if(isset($_GET['tid'])){
		$tid = intval($_GET['tid']);
	}else{
		reHome("".$root."/tin-nhan/");
	}
	if(isset($_GET['act']) && ($_GET['act'] == 'delete') ){
		$rs = $db->query("DELETE FROM ".$prefix."tinnhanrieng WHERE tnr_id = '".$tid."'");
		Redirect("Xóa thành công !","".$root."/tin-nhan/");
	}
	//Update tinhtrang
	$db->query("UPDATE ".$prefix."tinnhanrieng SET tnr_tinhtrang = 1 WHERE tnr_id = '".$tid."'");
	
	$rs = $db->query("SELECT * FROM ".$prefix."tinnhanrieng WHERE tnr_id = '".$tid."'");
	$row = $db->fetch_array($rs);
	
	$tnr_tieude = $myString->unQuote(stripslashes($row[tnr_tieude]));
	$tnr_noidung = $myString->unQuote(stripslashes($row[tnr_noidung]));
	$tnr_nguoinhan = $row[tnr_nguoinhan];
	$tnr_nguoigui = $row[tnr_nguoigui];

	$tnr_thoigian = format_date_time($row[tnr_thoigian]);
	$tnr_danhdau = $row[tnr_danhdau];
	$tnr_tinhtrang = $row[tnr_tinhtrang];
	
?>
<div>
   <span id="ctl00_idMainHolder_MessageSentDetail1_lblMess"></span>
</div>
<div class="inb_title_tr">
    <div class="inb_title_tl">
        <div class="inb_title_top"></div>

    </div>
</div>  
<div class="inb_title_body">
    <input name="submit" value="Xóa tin nhắn" type="button" onclick="javascript:window.location='<?=$root?>/?mod=tinnhan&m=xem&act=delete&tid=<?=$tid?>';">
</div>
<div class="inb6 headerMess">
    <div style="width: 80px; float: left;">
        Tiêu đề: 
    </div>
    <div style="width: 500px; float: left;">
			<?=$tnr_tieude?>
        
    </div>
</div>
<div class="inb6 headerMess">
    <div style="width: 80px; float: left;">
       <?
	   	if($tnr_nguoigui == $uid){
	   ?> 
		Người nhận:
		<? }else{ ?>
		Người gửi:
		<? } ?> 
    </div>
    <div style="width: 500px; float: left;">
        <?
			if($tnr_nguoigui == $uid){
				echo tenNguoiDung($tnr_nguoinhan);
			}else{
				echo tenNguoiDung($tnr_nguoigui);
			}
		?>
    </div>
</div>
<div class="inb7 headerMess">

    <div style="width: 80px; float: left;">
        Ngày gửi:
    </div>
    <div style="width: 500px; float: left;">
        <?=$tnr_thoigian?>
    </div>
</div>
<div class="inb6" style="padding-right: 10px;">
    <p><?=$tnr_noidung?></p>
</div>
<div class="BR" style="margin-bottom: 4px;">

    <div class="BL">
        <div class="BodyBottom"></div>
    </div>
</div>
